package com.charactereducation.pitchpalace.controller;

import com.charactereducation.module.vo.ApiCofig;
import com.charactereducation.pitchpalace.service.ApiCofigService;
import com.charactereducation.webcore.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Baggio on 2018-6-25.
 */
@RestController
@RequestMapping("/api/apiConfig")
public class ApiConfigController extends BaseController {
    @Autowired
    ApiCofigService apiCofigService;


    @PostMapping("/modify")
    public void modify(@RequestParam ApiCofig apiCofig) {

        apiCofigService.modifyApiCofig(apiCofig);

    }

    @GetMapping("/getApiCofig")
    public ApiCofig getApiCofig(@RequestParam ApiCofig apiCofig) {
        Map map = new HashMap<String,String>();
        map.put("channelId",apiCofig.getChannelId());
        map.put("tid",apiCofig.getTid());
        return apiCofigService.getApiCofig(new HashMap<>());
    }
    @GetMapping("/getApiCofigList")
    public List getApiCofigList() {
        return apiCofigService.getApiCofigList(new HashMap<>());
    }
    @PostMapping("/checkAPI")
    public void checkAPI(@RequestParam String channelId, String timestamp, String sign) {
        apiCofigService.checkAPI(channelId,timestamp,sign);
    }
}
